﻿<Window x:Class="WpfAppWcfRestConsumer.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="400" Width="625">
	<DockPanel>
		<Menu x:Name="MainMenu" DockPanel.Dock="Top">
			<MenuItem Header="File">
				<MenuItem Header="E_xit" x:Name="miExit" Click="miExit_Click"/>
			</MenuItem>

			<MenuItem Header="Others">
				<MenuItem Header="J_son" x:Name="miJson" Click="miJson_Click"/>
			</MenuItem>
		</Menu>
		<Grid>
			<Grid.RowDefinitions>
				<RowDefinition/>
				<RowDefinition Height="23"/>
			</Grid.RowDefinitions>
			<Grid.ColumnDefinitions>
				<ColumnDefinition />
				<ColumnDefinition />
				<ColumnDefinition />
			</Grid.ColumnDefinitions>

			<ListBox x:Name="lstPersons" ItemsSource="{Binding}" Grid.Column="1" SelectionChanged="lstPersons_SelectionChanged">
				<ListBox.ItemTemplate>
					<DataTemplate>
						<StackPanel>
							<TextBlock Text="{Binding Name}"/>
							<TextBlock Text="{Binding LastName}"/>
						</StackPanel>
					</DataTemplate>
				</ListBox.ItemTemplate>
				<ListBox.ContextMenu>
					<ContextMenu x:Name="PersonsContextMenu">
						<Separator/>
						<MenuItem x:Name="miDeletePerson" Header=" Delete person" Click="miDeletePerson_Click"/>
					</ContextMenu>
				</ListBox.ContextMenu>
			</ListBox>

			<ListBox x:Name="lstComments" ItemsSource="{Binding}" Grid.Column="2"
					 SelectionChanged="lstComments_SelectionChanged">
				<ListBox.ItemTemplate>
					<DataTemplate>
						<StackPanel>
							<TextBlock Text="{Binding CommentHead}"/>
							<TextBlock Text="{Binding CommentBody}"/>
							<TextBlock Text="{Binding Time, StringFormat='dd.MM.yyyy hh:ss'}"/>
						</StackPanel>
					</DataTemplate>
				</ListBox.ItemTemplate>
				<ListBox.ContextMenu>
					<ContextMenu x:Name="CommentContextMenu">
						<Separator/>
						<MenuItem x:Name="miDeleteComment" Header=" Delete comment" Click="miDeleteComment_Click"/>
					</ContextMenu>
				</ListBox.ContextMenu>
			</ListBox>

			<StackPanel Orientation="Vertical">
				<Button x:Name="btnGetPersons" Content="Get persons" Click="btnGetPersons_Click"/>
				<Button x:Name="btnAdd" Content="Add person" Click="btnAdd_Click"/>
				<Button x:Name="btnUpdatePerson" Content="Update person" Click="btnUpdatePerson_Click"/>
				<Button x:Name="btnAddComment" Content="Add comment" Click="btnAddComment_Click"/>
				<Button x:Name="btnUpdateComment" Content="Update comment" Click="btnUpdateComment_Click"/>
			</StackPanel>

			<StatusBar x:Name="mainStatus" DockPanel.Dock="Top" Grid.Row="1" Grid.ColumnSpan="3">
				<StackPanel Orientation="Horizontal">
					<TextBlock Text="User Id:" />
					<TextBlock x:Name="textId" />
				</StackPanel>
			</StatusBar>
		</Grid>
	</DockPanel>
</Window>
